package com.bob.debt.config;

import com.chinabond.dcotc.sdk.DCOTCClient;
import com.chinabond.dcotc.sdk.DCOTCSDKManage;
import com.chinabond.dcotc.sdk.interfaces.IOnServerMsgCallBack;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import java.util.concurrent.Executor;

/**
 * @author admin
 */
@Configuration
@Slf4j
public class DebtConfiguration {

    @Value("${DCOTCSDKConfig.configName:dcotcsdkconfig.properties}")
    private String DCOTCSDKConfigName;
    @Resource
    private IOnServerMsgCallBack dcotcServerMsgCallBack;
    @Resource(name = "dcotcExecutor")
    private Executor dcotcExecutor;

    @Bean(name = "DCOTCClient")
    public DCOTCClient creatClient() throws Exception {
        DCOTCClient dcotcClient = DCOTCSDKManage.createClient(DCOTCSDKConfigName, dcotcServerMsgCallBack, dcotcExecutor);
//        dcotcClient.start();
        return dcotcClient;
    }
}
